#include <list>
#include <iostream>
#include "SFML/System.hpp"
#include "SFML/Graphics.hpp"
#include <sstream>
#include "SFML/Window.hpp"
#include "pawn.hpp"
#include "judge.hpp"
#include "animation.hpp"

class Gui
{
public:
						Gui::Gui(Judge *, std::bitset<1444> *);
						Gui::~Gui();
	int					Gui::loop();
	int					Gui::selectMode();
private:
	sf::RenderWindow	*window;

	void				Gui::handleGameEvents();
	void				Gui::handleModeEvents();
	void				Gui::handleEndEvents();
	void				Gui::drawBackground();
	void				Gui::drawGrid();
	void				Gui::drawPawns();
	void				Gui::addPawn();
	void				Gui::loadTexture(int, char *);
	void				Gui::loadText(int, std::string);
	void				Gui::checkEnd();
	void				Gui::drawScores();
	bool				Gui::collides(int);
	void				Gui::runPlayer();
	void				Gui::runIA();

	int					fps;
	sf::Texture			textures[11];
	sf::Sprite			sprites[11];
	sf::Text			texts[6];
	const int			width, height;
	int					player, gridx, gridy, header, IAx, IAy;
	float				mousex, mousey;
	bool				singleplayer, replay;
	enum				{BLACK, WHITE, GRID, BACKGROUND, HOVER, P1WIN, P2WIN};
	enum				{SINGLEPLAYER, MULTIPLAYER, SCOREWHITE, SCOREBLACK, REPLAY, QUIT};
	std::list<Pawn*>	pawns;
	Judge				*referee;
	std::bitset<1444>	*map;
};